/**
 * @param {string} s
 * @return {number}
 */
var countAsterisks = function(s) {
  let count = 0, flag = false;
  for(let i = 0; i < s.length; i++) {
    if(!flag) {
      if(s[i] == '*') {
        count++;
      } else if(s[i] == '|') {
        flag = true;
      }
    } else {
      if(s[i] == '|') {
        flag = false;
      }
    }
  }
  return count;
};
let s = "l|*e*et|c**o|*de|";
console.log(countAsterisks(s));
s = "iamprogrammer";
console.log(countAsterisks(s));
s = "yo|uar|e**|b|e***au|tifu|l";
console.log(countAsterisks(s));
